package com.liang.Event;

import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Component;


/**
 * 发布事件处理器
 */
@Component
public class PublishService implements ApplicationEventPublisherAware {

    private ApplicationEventPublisher publisher ;


    @Override
    public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {

        publisher = applicationEventPublisher;

    }

    public void pub(Object event){

        publisher.publishEvent(event);

    }
}
